package com.qzw.security.service.entity;

import com.qzw.common.service.BaseEntity;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import javax.persistence.*;
import java.util.Set;

@Getter
@Setter
@ToString
@Entity
public class SysResource extends BaseEntity<Integer> {

    @Column(nullable = false, unique = true)
    private String resource;

    @ManyToMany
    @JoinTable(
            name = "sys_resource_permission",
            joinColumns = @JoinColumn(name = "resource_id", referencedColumnName = "id"),
            inverseJoinColumns = @JoinColumn(name = "permission_id", referencedColumnName = "id")
    )
    private Set<SysPermission> permissions;
}
